package com.luban.hs.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author: hs
 * @Description:
 * @Date: Create in 21:54 2019/2/2
 */
@ControllerAdvice
public class MyExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public String myHandlerError(HttpServletRequest request, Exception exception) {
        exception.printStackTrace();
        System.out.println("统一异常处理："+request.getRequestURI());
        return "统一异常处理返回的字符...";
    }

}
